//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    //深拷贝
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person("张三");
        Person person2 = (Person) person1.clone();
        //修改之前
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        person1.m.money = 19.99;
        //修改之后
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }
    //浅拷贝
    public static void main1(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person("张三");
        Person person2 = (Person) person1.clone();
        //修改之前
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        person1.m.money = 19.99;
        //修改之后
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }
}